/****** Object:  Stored Procedure dbo.spr_UpdateExDBOrdersByPK  ******/

 use [TourIS]
 GO

 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spr_UpdateExDBOrdersByPK]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 drop procedure [dbo].[spr_UpdateExDBOrdersByPK]
 GO

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS OFF
 GO

 CREATE  PROCEDURE [dbo].[spr_UpdateExDBOrdersByPK]
 (
	@clientid int,
	@orig_compid int,
	@compid int,
	@fromdate smalldatetime,
	@orderdate smalldatetime,
	@orig_orderid int,
	@orderid int,
	@todate smalldatetime
 )

 AS

 BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	UPDATE [Orders]
	SET
		[ClientId] = @clientid,
		[CompId] = @compid,
		[FromDate] = @fromdate,
		[OrderDate] = @orderdate,
		[OrderId] = @orderid,
		[ToDate] = @todate

	WHERE
	[CompId] = @orig_compid
	AND [OrderId] = @orig_orderid


	SET @Err = @@Error
	RETURN @Err
 END

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS ON
 GO

